<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .d{
            border: 1px  solid red;
            width: 100px;
            height:100px ;
        }

    </style>
</head>
<body>
 <div id="div1">
     div1
 </div>
 <div id="div2"> div2</div>
<script>
     var div = document.getElementById("div1");//获取div1 对象
     div.onclick=function() {//给div标签1绑定事件
         div.style.border = "1px solid red;";//通过style对象设置标签的属性
         div.style.width="200px";//
         div.style.height="100px";//
     }
        var div2 = document.getElementById("div2");//
      div2.onclick=function(){//通过htmldde dom对象设置标签的class名称从而控制标签的样式
          div2.className="d";//
      }

</script>//
</body>
</html>